﻿//----------------------------------------------------------------
// Desc: GUID对象
// Edit: ShowLong, http://blog.csdn.net/showlong
//
// Date Created: 2010-06-30
//
// Update Date : 
//
// Copyright (c) Fuel4D (http://www.fuel4d.com), All rights reserved.
//
// 注意：如果从FGUID派生，不支持虚析构
//
//----------------------------------------------------------------
#pragma once


#pragma pack(push, 1)


struct FGUID
{
	DWORD Data1;
	WORD Data2;
	WORD Data3;
	BYTE Data4[8];

    FGUID()
    {
        FMemzero(this, sizeof(*this));
    }
#if FUEL_OS_WINDOWS
    FGUID(GUID& id)
    {
        FMemcpy(this, &id, sizeof(GUID));
    }
#endif

    FINLINE bool operator == (const FGUID& _right) const
    {
        return (FMemcmp(this, &_right, sizeof(this)) == 0);
    }
    FINLINE bool operator < (const FGUID& _right) const
    {
        if (this->Data1 != _right.Data1) return this->Data1 < _right.Data1;
        if (this->Data1 != _right.Data1) return this->Data2 < _right.Data2;
        if (this->Data1 != _right.Data1) return this->Data3 < _right.Data3;
        if (this->Data4[0] != _right.Data4[0]) return this->Data4[0] < _right.Data4[0];
        if (this->Data4[1] != _right.Data4[1]) return this->Data4[1] < _right.Data4[1];
        if (this->Data4[2] != _right.Data4[2]) return this->Data4[2] < _right.Data4[2];
        if (this->Data4[3] != _right.Data4[3]) return this->Data4[3] < _right.Data4[3];
        if (this->Data4[4] != _right.Data4[4]) return this->Data4[4] < _right.Data4[4];
        if (this->Data4[5] != _right.Data4[5]) return this->Data4[5] < _right.Data4[5];
        if (this->Data4[6] != _right.Data4[6]) return this->Data4[6] < _right.Data4[6];
        if (this->Data4[7] != _right.Data4[7]) return this->Data4[7] < _right.Data4[7];
        return false;
    }
};


#pragma pack(pop)
